package com.mz.ozy.widget.dialog;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.mz.ozy.R;

/**
 * Created by administrator on 2019/4/4.
 * 日历弹窗
 */
public class RechargePopWindow extends BasePopupWindow implements View.OnClickListener {

    TextView mTvRechargeBaa;
    TextView mTvRechargeEth;

    public RechargePopWindow(Context mContext) {
        super(mContext, R.layout.recharge_pop_window, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
        this.mContext = mContext;

        mTvRechargeBaa = getView(R.id.tv_recharge_baa);
        mTvRechargeEth = getView(R.id.tv_recharge_eth);
        mTvRechargeBaa.setOnClickListener(this);
        mTvRechargeEth.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_recharge_baa:
                mTvRechargeBaa.setTextColor(ContextCompat.getColor(mContext, R.color.white));
                mTvRechargeBaa.setBackgroundResource(R.drawable.bg_solid_346fff_2dp);
                mTvRechargeEth.setTextColor(ContextCompat.getColor(mContext, R.color.text_color_999999));
                mTvRechargeEth.setBackgroundResource(R.drawable.bg_stroke_999999_2dp);
                if (mListener != null) {
                    mListener.onSelect(0);
                }
                break;
            case R.id.tv_recharge_eth: {
                mTvRechargeEth.setTextColor(ContextCompat.getColor(mContext, R.color.white));
                mTvRechargeEth.setBackgroundResource(R.drawable.bg_solid_346fff_2dp);
                mTvRechargeBaa.setTextColor(ContextCompat.getColor(mContext, R.color.text_color_999999));
                mTvRechargeBaa.setBackgroundResource(R.drawable.bg_stroke_999999_2dp);
                if (mListener != null) {
                    mListener.onSelect(1);
                }
                break;
            }
        }
        dismiss();
    }

    private OnConfirmListener mListener;

    public interface OnConfirmListener {
        void onSelect(int type);
    }

    public void setSelectListener(OnConfirmListener listener) {
        mListener = listener;
    }

}
